home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / network / ka9q / nhclb120.zoo / xfree.c < prev   
C/C++ Source or Header  |  1992-12-09  |  697b  |  43 lines

  1. #ifdef GNUC
  2. #include <stdlib.h>
  3. #endif
  4.  
  5. #ifndef MALLOC_DEBUG
  6. void xfree( m )
  7. char *m;
  8. {
  9.   if(m==(char *)0) return;
  10.   free(m);
  11.   return;
  12. }
  13. void *xmalloc(m)
  14. {
  15.   return((void *)malloc(m));
  16. }
  17.  
  18. #else
  19. #include <stdio.h>
  20. #include <malloc.h>
  21. static int seq;    /* sequence number */
  22. extern FILE *mall_deb;
  23. void xfree(p, f,l)
  24. char *p;
  25. char *f;   /* filename of call to  free */
  26. int l;     /* line number */
  27. {
  28. if(mall_deb)  fprintf(mall_deb,"%8x %8d %-14s %6d FREE \n",p,seq++,f,l);
  29.   if(p==(char *)0) return;
  30.   free(p);
  31.   return;
  32. }
  33. void *xmalloc(m,f,l)
  34. int m;
  35. char *f,*l;
  36. {
  37. char *al;
  38. al=malloc(m);
  39. if(mall_deb) fprintf(mall_deb,"%8x %8d %-14s %6d MALLOC %10d \n",al,seq++,f,l,m);
  40. return(al);
  41.      }
  42. #endif
  43.